home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / comm / mail / YAM23src.lha / Source / extrasrc / stcgfn.c < prev    next >
C/C++ Source or Header  |  2000-12-15  |  353b  |  20 lines

  1. #include <string.h>
  2. #include "extra.h"
  3.  
  4. /* Get the base name. */
  5.  
  6. int stcgfn(char *node, const char *name)
  7. {
  8.    const char *p = name + strlen(name);
  9.    const char *q = p;
  10.    while (p > name && p[-1] != '/' && p[-1] != ':')
  11.       --p;
  12.    if (q - p < FNSIZE)
  13.    {
  14.       memcpy(node, p, q - p + 1);
  15.       return q - p;
  16.    }
  17.    *node = '\0';
  18.    return 0;
  19. }
  20.